<template>
  <view class="authorPage">
    <view class="list">
      <view class="list_item" v-for="item in list" @tap="navigateTo(`/pages/author/detail/index?id=${item.userId}`)">
        <view class="left">
          <image class="avatarImg" :src="item.avatar"/>
          <view class="info">
            <text class="username">{{ item.nickName }}</text>
          </view>
        </view>
        <image class="rightIcon" :src="arrow"/>
      </view>
    </view>
  </view>
</template>

<script setup>
import arrow from '../../../assets/icon/arrow.png'
import Taro from "@tarojs/taro";
import './index.sass'
import {get} from "../../../util/request";
import {ref} from "vue";

const list = ref([])
const hasNextPage = ref(true)
const pageNum = ref(0)

const getList = async () => {
  const result = await get("author/list", {
    pageNum: pageNum.value,
    pageSize: 10,
  })
  list.value = list.value.concat(result.list)
  hasNextPage.value = result.hasNextPage
}

function navigateTo(url) {
  Taro.navigateTo({
    url: url
  })
}

Taro.showShareMenu({
  withShareTicket: true
})

function scrolltolower() {
  pageNum.value++
  getList()
}

getList()
</script>
